package com.yili.oa.dao;

import com.yili.oa.models.User;
import com.yili.oa.models.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UserMapper {
    @SelectProvider(type=UserSqlProvider.class, method="countByExample")
    long countByExample(UserExample example);

    @DeleteProvider(type=UserSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserExample example);

    @Delete({
        "delete from t_users",
        "where userid = #{userid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer userid);

    @Insert({
        "insert into t_users (userid, weak_mission_data, ",
        "account, name, sex, ",
        "headimg, signature, ",
        "lv, exp, coins, ",
        "gems, strongbox, ",
        "strongbox_password, roomid, ",
        "gametype, gamemode, ",
        "serverkey, history, ",
        "token, invitor_id, ",
        "agent_id, create_time, ",
        "last_share_time, highercode, ",
        "user_win, user_bout, ",
        "enable, last_login_time, ",
        "is_robot, invited_count, ",
        "is_agent, device, ",
        "device_uuid, is_guest, ",
        "promotion_award_claim, week_award_claim, ",
        "month_award_claim)",
        "values (#{userid,jdbcType=INTEGER}, #{weakMissionData,jdbcType=VARCHAR}, ",
        "#{account,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, ",
        "#{headimg,jdbcType=VARCHAR}, #{signature,jdbcType=VARCHAR}, ",
        "#{lv,jdbcType=SMALLINT}, #{exp,jdbcType=INTEGER}, #{coins,jdbcType=BIGINT}, ",
        "#{gems,jdbcType=INTEGER}, #{strongbox,jdbcType=BIGINT}, ",
        "#{strongboxPassword,jdbcType=VARCHAR}, #{roomid,jdbcType=VARCHAR}, ",
        "#{gametype,jdbcType=VARCHAR}, #{gamemode,jdbcType=VARCHAR}, ",
        "#{serverkey,jdbcType=VARCHAR}, #{history,jdbcType=VARCHAR}, ",
        "#{token,jdbcType=VARCHAR}, #{invitorId,jdbcType=INTEGER}, ",
        "#{agentId,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER}, ",
        "#{lastShareTime,jdbcType=BIGINT}, #{highercode,jdbcType=VARCHAR}, ",
        "#{userWin,jdbcType=VARCHAR}, #{userBout,jdbcType=VARCHAR}, ",
        "#{enable,jdbcType=TINYINT}, #{lastLoginTime,jdbcType=TIMESTAMP}, ",
        "#{isRobot,jdbcType=INTEGER}, #{invitedCount,jdbcType=INTEGER}, ",
        "#{isAgent,jdbcType=TINYINT}, #{device,jdbcType=VARCHAR}, ",
        "#{deviceUuid,jdbcType=VARCHAR}, #{isGuest,jdbcType=INTEGER}, ",
        "#{promotionAwardClaim,jdbcType=SMALLINT}, #{weekAwardClaim,jdbcType=SMALLINT}, ",
        "#{monthAwardClaim,jdbcType=SMALLINT})"
    })
    int insert(User record);

    @InsertProvider(type=UserSqlProvider.class, method="insertSelective")
    int insertSelective(User record);

    @SelectProvider(type=UserSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="userid", property="userid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="weak_mission_data", property="weakMissionData", jdbcType=JdbcType.VARCHAR),
        @Result(column="account", property="account", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="sex", property="sex", jdbcType=JdbcType.INTEGER),
        @Result(column="headimg", property="headimg", jdbcType=JdbcType.VARCHAR),
        @Result(column="signature", property="signature", jdbcType=JdbcType.VARCHAR),
        @Result(column="lv", property="lv", jdbcType=JdbcType.SMALLINT),
        @Result(column="exp", property="exp", jdbcType=JdbcType.INTEGER),
        @Result(column="coins", property="coins", jdbcType=JdbcType.BIGINT),
        @Result(column="gems", property="gems", jdbcType=JdbcType.INTEGER),
        @Result(column="strongbox", property="strongbox", jdbcType=JdbcType.BIGINT),
        @Result(column="strongbox_password", property="strongboxPassword", jdbcType=JdbcType.VARCHAR),
        @Result(column="roomid", property="roomid", jdbcType=JdbcType.VARCHAR),
        @Result(column="gametype", property="gametype", jdbcType=JdbcType.VARCHAR),
        @Result(column="gamemode", property="gamemode", jdbcType=JdbcType.VARCHAR),
        @Result(column="serverkey", property="serverkey", jdbcType=JdbcType.VARCHAR),
        @Result(column="history", property="history", jdbcType=JdbcType.VARCHAR),
        @Result(column="token", property="token", jdbcType=JdbcType.VARCHAR),
        @Result(column="invitor_id", property="invitorId", jdbcType=JdbcType.INTEGER),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.INTEGER),
        @Result(column="last_share_time", property="lastShareTime", jdbcType=JdbcType.BIGINT),
        @Result(column="highercode", property="highercode", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_win", property="userWin", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_bout", property="userBout", jdbcType=JdbcType.VARCHAR),
        @Result(column="enable", property="enable", jdbcType=JdbcType.TINYINT),
        @Result(column="last_login_time", property="lastLoginTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="is_robot", property="isRobot", jdbcType=JdbcType.INTEGER),
        @Result(column="invited_count", property="invitedCount", jdbcType=JdbcType.INTEGER),
        @Result(column="is_agent", property="isAgent", jdbcType=JdbcType.TINYINT),
        @Result(column="device", property="device", jdbcType=JdbcType.VARCHAR),
        @Result(column="device_uuid", property="deviceUuid", jdbcType=JdbcType.VARCHAR),
        @Result(column="is_guest", property="isGuest", jdbcType=JdbcType.INTEGER),
        @Result(column="promotion_award_claim", property="promotionAwardClaim", jdbcType=JdbcType.SMALLINT),
        @Result(column="week_award_claim", property="weekAwardClaim", jdbcType=JdbcType.SMALLINT),
        @Result(column="month_award_claim", property="monthAwardClaim", jdbcType=JdbcType.SMALLINT)
    })
    List<User> selectByExample(UserExample example);

    @Select({
        "select",
        "userid, weak_mission_data, account, name, sex, headimg, signature, lv, exp, ",
        "coins, gems, strongbox, strongbox_password, roomid, gametype, gamemode, serverkey, ",
        "history, token, invitor_id, agent_id, create_time, last_share_time, highercode, ",
        "user_win, user_bout, enable, last_login_time, is_robot, invited_count, is_agent, ",
        "device, device_uuid, is_guest, promotion_award_claim, week_award_claim, month_award_claim",
        "from t_users",
        "where userid = #{userid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="userid", property="userid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="weak_mission_data", property="weakMissionData", jdbcType=JdbcType.VARCHAR),
        @Result(column="account", property="account", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="sex", property="sex", jdbcType=JdbcType.INTEGER),
        @Result(column="headimg", property="headimg", jdbcType=JdbcType.VARCHAR),
        @Result(column="signature", property="signature", jdbcType=JdbcType.VARCHAR),
        @Result(column="lv", property="lv", jdbcType=JdbcType.SMALLINT),
        @Result(column="exp", property="exp", jdbcType=JdbcType.INTEGER),
        @Result(column="coins", property="coins", jdbcType=JdbcType.BIGINT),
        @Result(column="gems", property="gems", jdbcType=JdbcType.INTEGER),
        @Result(column="strongbox", property="strongbox", jdbcType=JdbcType.BIGINT),
        @Result(column="strongbox_password", property="strongboxPassword", jdbcType=JdbcType.VARCHAR),
        @Result(column="roomid", property="roomid", jdbcType=JdbcType.VARCHAR),
        @Result(column="gametype", property="gametype", jdbcType=JdbcType.VARCHAR),
        @Result(column="gamemode", property="gamemode", jdbcType=JdbcType.VARCHAR),
        @Result(column="serverkey", property="serverkey", jdbcType=JdbcType.VARCHAR),
        @Result(column="history", property="history", jdbcType=JdbcType.VARCHAR),
        @Result(column="token", property="token", jdbcType=JdbcType.VARCHAR),
        @Result(column="invitor_id", property="invitorId", jdbcType=JdbcType.INTEGER),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.INTEGER),
        @Result(column="last_share_time", property="lastShareTime", jdbcType=JdbcType.BIGINT),
        @Result(column="highercode", property="highercode", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_win", property="userWin", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_bout", property="userBout", jdbcType=JdbcType.VARCHAR),
        @Result(column="enable", property="enable", jdbcType=JdbcType.TINYINT),
        @Result(column="last_login_time", property="lastLoginTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="is_robot", property="isRobot", jdbcType=JdbcType.INTEGER),
        @Result(column="invited_count", property="invitedCount", jdbcType=JdbcType.INTEGER),
        @Result(column="is_agent", property="isAgent", jdbcType=JdbcType.TINYINT),
        @Result(column="device", property="device", jdbcType=JdbcType.VARCHAR),
        @Result(column="device_uuid", property="deviceUuid", jdbcType=JdbcType.VARCHAR),
        @Result(column="is_guest", property="isGuest", jdbcType=JdbcType.INTEGER),
        @Result(column="promotion_award_claim", property="promotionAwardClaim", jdbcType=JdbcType.SMALLINT),
        @Result(column="week_award_claim", property="weekAwardClaim", jdbcType=JdbcType.SMALLINT),
        @Result(column="month_award_claim", property="monthAwardClaim", jdbcType=JdbcType.SMALLINT)
    })
    User selectByPrimaryKey(Integer userid);

    @UpdateProvider(type=UserSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    @UpdateProvider(type=UserSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    @UpdateProvider(type=UserSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(User record);

    @Update({
        "update t_users",
        "set weak_mission_data = #{weakMissionData,jdbcType=VARCHAR},",
          "account = #{account,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR},",
          "sex = #{sex,jdbcType=INTEGER},",
          "headimg = #{headimg,jdbcType=VARCHAR},",
          "signature = #{signature,jdbcType=VARCHAR},",
          "lv = #{lv,jdbcType=SMALLINT},",
          "exp = #{exp,jdbcType=INTEGER},",
          "coins = #{coins,jdbcType=BIGINT},",
          "gems = #{gems,jdbcType=INTEGER},",
          "strongbox = #{strongbox,jdbcType=BIGINT},",
          "strongbox_password = #{strongboxPassword,jdbcType=VARCHAR},",
          "roomid = #{roomid,jdbcType=VARCHAR},",
          "gametype = #{gametype,jdbcType=VARCHAR},",
          "gamemode = #{gamemode,jdbcType=VARCHAR},",
          "serverkey = #{serverkey,jdbcType=VARCHAR},",
          "history = #{history,jdbcType=VARCHAR},",
          "token = #{token,jdbcType=VARCHAR},",
          "invitor_id = #{invitorId,jdbcType=INTEGER},",
          "agent_id = #{agentId,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=INTEGER},",
          "last_share_time = #{lastShareTime,jdbcType=BIGINT},",
          "highercode = #{highercode,jdbcType=VARCHAR},",
          "user_win = #{userWin,jdbcType=VARCHAR},",
          "user_bout = #{userBout,jdbcType=VARCHAR},",
          "enable = #{enable,jdbcType=TINYINT},",
          "last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},",
          "is_robot = #{isRobot,jdbcType=INTEGER},",
          "invited_count = #{invitedCount,jdbcType=INTEGER},",
          "is_agent = #{isAgent,jdbcType=TINYINT},",
          "device = #{device,jdbcType=VARCHAR},",
          "device_uuid = #{deviceUuid,jdbcType=VARCHAR},",
          "is_guest = #{isGuest,jdbcType=INTEGER},",
          "promotion_award_claim = #{promotionAwardClaim,jdbcType=SMALLINT},",
          "week_award_claim = #{weekAwardClaim,jdbcType=SMALLINT},",
          "month_award_claim = #{monthAwardClaim,jdbcType=SMALLINT}",
        "where userid = #{userid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(User record);
}